<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:comp="http://java.sun.com/jsf/composite"
      xmlns:cc="http://java.sun.com/jsf/composite/cc"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xml:lang="en" lang="en">
<comp:interface>
    <comp:attribute name="bean" required="true" type="za.co.yellowfire.domain.training.TrainingCourse" shortDescription="The training course bean for the form" />
    <comp:attribute name="readonly" required="false" default="true" type="java.lang.Boolean" shortDescription="Whether the data is editable" />
    <comp:attribute name="durationTypes" required="true" shortDescription="The duration types for the form" />
    <comp:attribute name="trainingProviders" required="true" shortDescription="The training providers for the form" />
    <comp:attribute name="contentTypes" required="true" shortDescription="The content types for the form" />
    <comp:attribute name="categories" required="true" shortDescription="The training categories for the form" />

</comp:interface>
<comp:implementation>
    <style type="text/css">
        .course_col1 {width: 50%; vertical-align: top;}
        .course_col2 {width: 50%; vertical-align: top;}
        .duration_col1 {width: 30%;}
        .duration_col2 {width: 60%;}
        .duration_col3 {width: 5%;}
        .align_top {vertical-align: top;}
    </style>
    <h:panelGrid columns="2" columnClasses="course_col1,course_col2">
        <h:panelGroup>
            <p:fieldset legend="#{msgs['pnl.overview']}">
                <h:panelGrid id="modify_display" columns="2" cellpadding="4" columnClasses="align_top,align_top">

                    <h:outputText value="#{msgs['fld.id']}:"/>
                    <cc:inputText label="#{msgs['fld.id']}" value="#{cc.attrs.bean.id}" readonly="true" required="true" />

                    <h:outputText value="#{msgs['fld.title']}:"/>
                    <cc:inputText label="#{msgs['fld.title']}" value="#{cc.attrs.bean.title}" readonly="#{cc.attrs.readonly}" required="true" />

                    <h:outputLabel value="#{msgs['fld.overview']}:"/>
                    <cc:inputTextArea label="#{msgs['fld.overview']}" value="#{cc.attrs.bean.overview}" rows="3" cols="50" readonly="#{cc.attrs.readonly}"/>

                    <h:outputText value="#{msgs['fld.duration']}:" />
                    <cc:inputDuration label="#{msgs['fld.duration']}" value="#{cc.attrs.bean.duration}" durationType="#{cc.attrs.bean.durationType}" durationTypes="#{cc.attrs.durationTypes}" readonly="#{cc.attrs.readonly}" />
                </h:panelGrid>
            </p:fieldset>
            <p:fieldset legend="#{msgs['pnl.settings']}">
                <h:panelGrid columns="2" styleClass="width100pc">
                    <h:panelGroup>
                        <h:outputLabel value="#{msgs['fld.core']}:" for="cb01"/>
                        <cc:inputCheckbox id="cb01" label="#{msgs['fld.core']}" value="#{cc.attrs.bean.core}" readonly="#{cc.attrs.readonly}" />
                    </h:panelGroup>
                    <h:panelGroup>
                        <h:outputLabel value="#{msgs['fld.internal']}:" for="cb02" />
                        <cc:inputCheckbox id="cb02" label="#{msgs['fld.internal']}" value="#{cc.attrs.bean.internal}" readonly="#{cc.attrs.readonly}" />
                    </h:panelGroup>
                </h:panelGrid>
            </p:fieldset>
        </h:panelGroup>
        <h:panelGroup style="width:100%">
            <h:panelGrid columns="1" styleClass="width100pc">
                <p:fieldset legend="#{msgs['pnl.contact']}">
                    <h:panelGrid columns="2" columnClasses="align_top width30pc,align_top width70pc" styleClass="width100pc">
                        <h:outputText value="#{msgs['fld.contact.name']}:"/>
                        <cc:inputText label="#{msgs['fld.contact.name']}" value="#{cc.attrs.bean.contact.name}" readonly="#{cc.attrs.readonly}" required="false" />
                        <h:outputText value="#{msgs['fld.contact.tel']}:"/>
                        <cc:inputText label="#{msgs['fld.contact.tel']}" value="#{cc.attrs.bean.contact.telephoneNo}" readonly="#{cc.attrs.readonly}" required="false" />
                    </h:panelGrid>
                </p:fieldset>
                <p:fieldset legend="#{msgs['pnl.detail']}">
                    <h:panelGrid columns="2" columnClasses="align_top width30pc,align_top width70pc" styleClass="width100pc">
                        
                        <h:outputText value="#{msgs['fld.training.category']}:" for="a04" />
                        <h:panelGroup style="width:100%">
                            <h:panelGrid columns="2" styleClass="width100pc" columnClasses="width95pc,width5pc">
                                <h:selectOneMenu
                                        id="a04"
                                        label="#{msgs['fld.training.category']}"
                                        value="#{cc.attrs.bean.category}"
                                        styleClass="width100pc"
                                        rendered="#{!cc.attrs.readonly}">
                                    <f:selectItem value="#{coursesController.nullSelectItem}" />
                                    <f:selectItems
                                            value="#{cc.attrs.trainingCategories}"
                                            var="category"
                                            itemLabel="#{category.description}"
                                            itemDescription="#{category.description}"
                                            itemValue="#{category}"  />
                                </h:selectOneMenu>
                                <h:outputText id="ra04" value="#{cc.attrs.bean.category != null ? cc.attrs.bean.category.description : 'None'}" styleClass="width100pc" rendered="#{cc.attrs.readonly}" />
                                <p:message for="a04" showSummary="false" showDetail="false" display="icon" />
                            </h:panelGrid>
                        </h:panelGroup>

                        <h:outputText value="#{msgs['fld.training.provider']}:" for="a03" />
                        <h:panelGroup style="width:100%">
                            <h:panelGrid columns="2" styleClass="width100pc" columnClasses="width95pc,width5pc">
                                <h:selectOneMenu
                                        id="a03"
                                        label="#{msgs['fld.training.provider']}"
                                        value="#{cc.attrs.bean.provider}"
                                        styleClass="width100pc"
                                        rendered="#{!cc.attrs.readonly}">
                                    <f:selectItem value="#{coursesController.nullSelectItem}" />
                                    <f:selectItems
                                            value="#{cc.attrs.trainingProviders}"
                                            var="provider"
                                            itemLabel="#{provider.name}"
                                            itemDescription="#{provider.name}"
                                            itemValue="#{provider}"  />
                                </h:selectOneMenu>
                                <h:outputText id="ra03" value="#{cc.attrs.bean.provider != null ? cc.attrs.bean.provider.name : 'None'}" styleClass="width100pc" rendered="#{cc.attrs.readonly}" />
                                <p:message for="a03" showSummary="false" showDetail="false" display="icon" />
                            </h:panelGrid>
                        </h:panelGroup>

                        <h:outputText value="#{msgs['fld.content.type']}:" for="a07" />
                        <h:panelGroup style="width:100%">
                            <h:panelGrid columns="2" styleClass="width100pc" columnClasses="width95pc,width5pc">
                                <h:selectOneMenu
                                        id="a07"
                                        label="#{msgs['fld.content.type']}"
                                        value="#{cc.attrs.bean.contentType}"
                                        styleClass="width100pc"
                                        rendered="#{!cc.attrs.readonly}">

                                    <f:selectItem value="#{coursesController.nullSelectItem}" />
                                    <f:selectItems
                                            value="#{cc.attrs.contentTypes}"
                                            var="contentType"
                                            itemLabel="#{contentType.description}"
                                            itemDescription="#{contentType.description}"
                                            itemValue="#{contentType}"  />
                                </h:selectOneMenu>
                                <h:outputText id="ra07" value="#{cc.attrs.bean.contentType != null ? cc.attrs.bean.contentType.description : 'None'}" styleClass="width100pc" rendered="#{cc.attrs.readonly}" />
                                <p:message for="a07" showSummary="false" showDetail="false" display="icon" />
                            </h:panelGrid>
                        </h:panelGroup>

                        <h:outputText value="#{msgs['fld.accrediting.body']}:"/>
                        <cc:inputText label="#{msgs['fld.accrediting.body']}" value="#{cc.attrs.bean.accreditingBody}" readonly="#{cc.attrs.readonly}" />
                        
                    </h:panelGrid>
                </p:fieldset>
            </h:panelGrid>
        </h:panelGroup>
    </h:panelGrid>
</comp:implementation>
</html>
